﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System8ToyMC
{
	public partial class HistogramListDisplayUC : UserControl
	{
		public HistogramListDisplayUC()
		{
			// Required to initialize variables
			InitializeComponent();
		}

        /// <summary>
        /// Add a plot to our internal list! :-)
        /// </summary>
        /// <param name="hf"></param>
        /// <returns></returns>
        public void AddPlot(Histogram hf)
        {
            HList.Items.Add(hf);

            ///
            /// Hook up the behavior...
            /// 

            HistogramPopupBehavior bh = new HistogramPopupBehavior();
            bh.Attach(hf);
            hf.MouseLeftButtonUp += (o, a) => bh.ShowPopUp.Execute(null);
        }

        public void RemovePlot(Histogram hf)
        {
            HList.Items.Remove(hf);
        }
    }
}